1

00:00:00,760  -->  00:00:07,100
In the last two video, we learn how to doing
network automation on cisco and  mikrotik router.

2

00:00:07,600  -->  00:00:14,660
In this video we are going to combine that
two topics, so in the end of this video, you

3

00:00:14,660  -->  00:00:19,960
will able to doing network automation on cisco
and mikrotik router at once.

4

00:00:20,680  -->  00:00:27,560
This is the script that we will use in this
video. Here we have a list of dictionary that

5

00:00:27,560  -->  00:00:33,560
save the router information like ip address,
vendor, username, and password.

6

00:00:33,900  -->  00:00:43,280
The first dictionary save the information
about cisco router, the ip address is 192.168.1.2

7

00:00:43,660  -->  00:00:53,340
the vendor is cisco, the username and password
is also cisco. I am sorry, the IP Address

8

00:00:53,340  -->  00:00:56,880
of cisco router is 192.168.1.3

9

00:00:57,300  -->  00:01:03,440
The second dictionary save the information
about mikrotik routers, the ip address is

10

00:01:03,440  -->  00:01:12,240
192.168.1.2, the vendor is mikrotik, the username
is admin, and the password is blank

11

00:01:12,740  -->  00:01:22,740
We call SSH Client function from paramiko
, and Here we doing a loop to devices

12

00:01:23,040  -->  00:01:32,160
which is the list that we have defined before. Here
we connect to the device [“ip_address”]

13

00:01:32,800  -->  00:01:43,060
this is will be 192.168.1.3 and 192.168.1.2,
using the username and  password from dictionary.

14

00:01:45,880  -->  00:01:50,300
Here we just print that we have successfully
login to the router.

15

00:01:50,360  -->  00:01:59,160
We have a condition in here, if the vendor
is cisco, the script will invoke the shell

16

00:01:59,160  -->  00:02:07,520
and send cisco command, also will print the
output to the console. But if the vendor is

17

00:02:07,520  -->  00:02:14,160
not cisco, which means that the vendor is
mikrotik, the script will not invoke the shell,

18

00:02:14,180  -->  00:02:19,500
instead send the mikrotik command directly,
you can see that we don’t need to sleep

19

00:02:19,500  -->  00:02:27,040
the script if the device is mikrotik. Last
don’t forget to close the ssh connection.

20

00:02:28,240  -->  00:02:41,240
Save the file, open a command prompt and make
sure that we are in the right directory

21

00:02:41,240  -->  00:02:47,600
Here we can see that we have script3.py. Let’s
run the code

22

00:02:55,000  -->  00:03:00,400
First, the code will connect to cisco 
and configure loopback 2 interface with ip

23

00:03:00,400  -->  00:03:11,140
address 10.1.1.3, and then connect to mikrotik
router and configure loopback1, with ip address 10.2.2.2

24

00:03:11,140  -->  00:03:17,820
Okay our script executed successfully, let’s
check on the cisco router

25

00:03:22,180  -->  00:03:30,060
Here we can see that now we have loopback2 interface with
ip address 10.1.1.3.

26

00:03:31,060  -->  00:03:42,180
Let’s also check on mikrotik router. Here
we can see that we also have a new ip address,

27

00:03:42,180  -->  00:03:45,940
which is 10.2.2.2 on loopback1.

28

00:03:46,640  -->  00:03:53,200
Cool ! We are successfully doing Network Automation
on cisco &amp; mikrotik routers at once

29

00:03:53,660  -->  00:03:57,220
Thankyou for watching and see you on the next video.
